﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Net.Mail;
using System.Web.Services;
using AjaxControlToolkit;
using System.IO.MemoryMappedFiles;

public partial class admin_admin_update_client : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Response.Redirect("sessiont.aspx");
        }
        int s = 0;
        Label7.Text = s.ToString();
        Label2.Text = Session["email"].ToString();



        if (Page.IsPostBack)
        {
        }
        else
        {

            SqlConnection conn = null;
            conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
            conn.Open();
            SqlCommand scmd = new SqlCommand("SELECT * FROM client_sell where c_id='" + Session["c_id"] + "'", conn);

            SqlDataReader dr = scmd.ExecuteReader();
            if (dr.Read())
            {
                
                txthno.Text = dr[8].ToString();
                txtcity.Text = dr[9].ToString();
                txtstreet.Text = dr[10].ToString();
                txtssn.Text = dr[11].ToString();
                txtzip.Text = dr[12].ToString();
                txtcountry.Text = dr[13].ToString();
                txtemail.Text = dr[14].ToString();
                txtphno.Text = dr[15].ToString();
                TextBox8.Text = dr[16].ToString();
                TextBox9.Text = dr[22].ToString();
                TextBox3.Text = dr[17].ToString();
                TextBox4.Text = dr[18].ToString();
                TextBox5.Text = dr[19].ToString();
                
                TextBox12.Text = dr[24].ToString();
                TextBox14.Text = dr[25].ToString();
                TextBox6.Text = dr[28].ToString();
                TextBox13.Text = dr[34].ToString();
                txtmname.Text = dr[6].ToString();
                TextBox15.Text = dr[33].ToString();
                //string str = "0";
                //if (str.Equals(0))
                //{
                //    CheckBox9.Checked= t

                //}
               
             Label8 .Text  = Session["c_id"].ToString();





            }


            dr.Close();
        }
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        string field = txtfield.Text + DropDownList10.SelectedValue;


        string p_size = TextBox11.Text + DropDownList7.SelectedValue;

        SqlConnection conn = null;
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn.Open();

        SqlCommand cm1 = new SqlCommand("update client_sell set type='" + DropDownList5.SelectedValue + "', property='" + DropDownList6.SelectedValue + "',agent_name='" + DropDownList15.SelectedValue + "', client_fullname='" + txtmname .Text + "', property_type='" + txtname1.Text + "', house_no='" + txthno.Text + "', city='" + txtcity.Text + "', street='" + txtstreet.Text + "', ssn='" + txtssn.Text + "', zip='" + txtzip.Text + "', country='" + txtcountry.Text + "', email_id='" + txtemail.Text + "', phone='" + txtphno.Text + "', block='" + TextBox8.Text + "', room_no='"+ TextBox3.Text+"', floor='"+ TextBox4.Text +"', safe_room='"+ TextBox5.Text+"', ac='"+ DropDownList16.Text+"',elevator='"+ DropDownList16.Text+"', price='"+ TextBox9.Text +"',p_size='"+ p_size +"',evacuation_date='"+ TextBox12.Text+"', number_of_room='"+ TextBox14.Text+"',fields='"+ field +"',electric_boiler='"+ DropDownList9.Text +"',electric='"+ TextBox16.Text +"', kitchen='" + DropDownList12.SelectedValue + "', prop_condition='"+ DropDownList12.SelectedValue +"', balconies='"+ DropDownList14.SelectedValue+"',balcony_size='"+ DropDownList17 .SelectedValue + "',b_prevelage='"+ TextBox15.Text + "',comments='"+ TextBox13.Text+"',parking='"+ ddlcategory.SelectedValue +"', c_parking='" + txtpark.Text +"',furniture='"+ DropDownList18.SelectedValue +"',c_furniture='"+ txtfurniture.Text +"', toilets='"+ DropDownList19.SelectedValue+"',c_toilets='" + txttoilets.Text+"',shower= '"+ DropDownList16 .SelectedValue +"', c_shower='" + TextBox16.Text+"', c_park='" + DropDownList1.SelectedValue +"', c_park_info='"+ txtcatname.Text +"',direction='" + CheckBox9.Checked +"',smart_house='"+ CheckBox1.Checked +"',alarm='" + CheckBox2 .Checked +"',bars='"+ CheckBox3.Checked+"',handicap='"+ CheckBox4.Checked +"',teather_room='" + CheckBox5.Checked +"', gym='"+ CheckBox6.Checked +"',jacuzie='"+ CheckBox7.Checked + "',pool='"+ CheckBox8 .Checked +"' where c_id='" + Session["c_id"] + "'", conn);
        cm1.ExecuteNonQuery();
        Response.Redirect("partner_update_client_conf.aspx");
        conn.Close();
    }
    protected void Cancel_Click(object sender, EventArgs e)
    {

    }
    protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
    {
       
    }
    protected void LinkButton1_Click(object sender, System.EventArgs e)
    {
        Session.Abandon();
          Response.Redirect("../partner.aspx");
    }
}